package com.guaju.yueshangLife.activity.mine;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.guaju.yueshangLife.R;
import com.guaju.yueshangLife.activity.MainActivity;
import com.guaju.yueshangLife.activity.OrderListActivity;
import com.guaju.yueshangLife.adapter.SelectOrderListAdapter;
import com.guaju.yueshangLife.base.BaseActivity;
import com.guaju.yueshangLife.databinding.ActivitySelectOrderListBinding;

import java.util.ArrayList;

public class SelectOrderListActivity extends BaseActivity {
    ActivitySelectOrderListBinding binding;

    @Override
    protected void loadViewLayout() {
        binding = DataBindingUtil.setContentView(this, R.layout.activity_select_order_list);
    }

    @Override
    protected void bindViews() {
        setEmpty(false);

    }

    @Override
    protected void processLogic(Bundle savedInstanceState) {
        ArrayList arrayList = new ArrayList();
        arrayList.add("");
        arrayList.add("");
        arrayList.add("");
        SelectOrderListAdapter selectOrderListAdapter = new SelectOrderListAdapter(SelectOrderListActivity.this, arrayList);
        binding.recyclerview.setAdapter(selectOrderListAdapter);
    }

    @Override
    protected void setListener() {
        binding.orderEmpty.getRoot().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SelectOrderListActivity.this, MainActivity.class);
                intent.putExtra(MainActivity.TAB_POSITION, 0);
                startActivity(intent);
                finish();
            }
        });
    }

    public void setEmpty(boolean value) {
        if (value) {
            binding.orderEmpty.getRoot().setVisibility(View.VISIBLE);
            binding.llList.setVisibility(View.GONE);
        } else {
            binding.orderEmpty.getRoot().setVisibility(View.GONE);
            binding.llList.setVisibility(View.VISIBLE);
        }
    }
}
